import java.io.Serializable;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;


public class TestMethod extends Base{


	public static void main(String[] args) {
		TestMethod t = new TestMethod();
		t.view();
	}
	public void view(){
		System.out.println(getName());
	}

}

abstract class Base<T,ID extends Serializable> {
	private String name;
	
	public Base() {
		this.name = init();
	}
	
	@SuppressWarnings("all")
	private String init(){
		Type genType = this.getClass().getGenericSuperclass();
		if( !(genType instanceof ParameterizedType) ){
			throw new RuntimeException("请将Controller的泛型补充完整");
		}
		Type param = ((ParameterizedType) genType).getActualTypeArguments()[0];
		String entity = ( (Class<T>) param ).getName();
		return entity.substring(entity.lastIndexOf(".")+1);
	}
	
	public String getName(){
		return name;
	}
	
}
